package com.felix.io.nio;


/**
 * Server
 *
 * @author xjh
 * @version 1.0
 * @date 2019-02-21
 */
public class Server {

    private static int DEFAULT_PORT = 12345;
    private static ServerHandler serverHandler;
    public static void start(){
        start(DEFAULT_PORT);
    }
    public static synchronized void start(int port){
        if(serverHandler!=null) {
            serverHandler.stop();
        }
        serverHandler = new ServerHandler(port);
        new Thread(serverHandler,"Server").start();
    }
    public static void main(String[] args){
        start();
    }
}
